
<script setup>
import * as echarts from "echarts";
import { ref, onMounted } from "vue";
const chart = ref(); // 创建dom引用
onMounted(() => {
    var myChart = echarts.init(chart.value)
  var option = {
    xAxis: {
      type: "category",
      data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
    },
    yAxis: {
      type: "value",
    },
    series: [
      {
        data: [150, 230, 224, 218, 135, 147, 260],
        type: "line",
      },
    ],
  };

//   使用刚指定的配置项和数据显示图标
myChart.setOption(option)
});
</script>
<template>
  <div>
    <div ref="chart" style="width: 600px; height: 400px"></div>
  </div>
</template>

<style scoped>
.chart {
  height: 400px;
}
</style>